import React from 'react';
import RCDatePicker from '../../m-group/m-date-picker/DatePicker';
import { getComponentLocale } from '../_util/getLocale';

export default class DatePickerView extends React.Component{
  static defaultProps = {
    mode: 'datetime',
    extra: '请选择',
    minuteStep: 1,
    use12Hours: false,
  };

  render() {
    const { props, context } = this;
    const locale = getComponentLocale(props, context, 'DatePickerView', () =>
      require('./locale/zh_CN'),
    );

    // Here Use `date` instead of `defaultDate`, make it controlled fully.
    return (
      <RCDatePicker
        {...props}
        locale={locale}
        date={props.value}
        onDateChange={props.onChange}
        onValueChange={props.onValueChange}
        onScrollChange={props.onScrollChange}
      />
    );
  }
}
